﻿using HLStock.Common;
using HLStock.Model;
using HLStock.WmsService;

namespace HLStock.DBAccess.AOP
{
    public class StockOutSourceCheckAction : IBeforeSaveAction<StockRecordModel>
    {
        public void Handle(BeforeSaveEventArgs<StockRecordModel> arg)
        {
            if (arg.Data.Type == StockType.Out) 
            {
                if (String.IsNullOrWhiteSpace(arg.Data.SrcRecord))
                {
                    arg.Cancle = true;
                    arg.Message = "出库记录必须要有来源";
                    return;
                }
                
            }
        }
         
    }
}
